<!DOCTYPE html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@include file="/WEB-INF/view/common/common.jsp" %>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport"
          content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="${keywords}">
    <meta http-equiv="description" content="">
    <%@include file="/WEB-INF/view/common/head_css.jsp" %>
    <%@include file="/WEB-INF/view/common/head_css_startbootstrap.jsp" %>
    <%@include file="/WEB-INF/view/common/head_css_morris.jsp" %>
    <%@include file="/WEB-INF/view/common/head_css_treeview.jsp" %>
    <%@include file="/WEB-INF/view/common/head_css_datatables.jsp" %>
    <%@include file="/WEB-INF/view/common/head_css_fav.jsp" %>
    <%@include file="/WEB-INF/view/common/datepicker_css.jsp" %>
    <title>账户名称</title>
</head>
<body>
<div id="wrapper">
    <jsp:include page="/menu.html"></jsp:include>
    <div id="page-wrapper">
        <%--<nav class="navbar navbar-default" role="navigation">--%>
            <%--<div class="container-fluid">--%>
                <%--<div class="navbar-header">--%>
                    <%--<button type="button"--%>
                            <%--class="navbar-toggle animated flip pull-left"--%>
                            <%--data-toggle="collapse" data-target=".agent-navbar-collapse">--%>
                        <%--<span class="sr-only">Toggle navigation</span> <span--%>
                            <%--class="icon-bar"></span> <span class="icon-bar"></span> <span--%>
                            <%--class="icon-bar"></span>--%>
                    <%--</button>--%>
                <%--</div>--%>
                <%--<div class="collapse navbar-collapse agent-navbar-collapse" id="top-navbar-collapse">--%>
                        <%--<ul class="nav navbar-nav navbar-right" style="padding: 10px">--%>
                            <%--<li>--%>
                                <%--<button type="button"--%>
                                        <%--class="btn btn-primary navbar-btn addBtn">--%>
                            <%--<li class="fa fa-plus-square fa-fw"></li>--%>
                            <%--新增塔层--%>
                            <%--</button></li>--%>
                        <%--</ul>--%>
                <%--</div>--%>
            <%--</div>--%>
        <%--</nav>--%>
        <div class="row">
            <div class="col-lg-12 col-md-12">
                <div class="table-responsive">
                    <table
                            class="table table-striped table-bordered table-hover table-condensed">
                        <thead>
                        <tr>
                            <th>选择</th>
                            <th>ID</th>
                            <th>枚举状态</th>
                            <th>庄户名称</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody id="dataList">
                        <c:forEach items="${List}" var="g">
                            <tr data-row="${g.id}">
                                <td><input type="checkbox" value="${g.id}"></td>
                                <td>${g.id}</td>
                                <td>${g.statusNumber}</td>
                                <td>${g.name}</td>
                                <td>
                                    <a class="btn btn-success default editBtn"
                                       href="<c:url value='/accountsName/edit.html?id=${g.id}' /> ">
                                        <span class="glyphicon glyphicon-wrench" aria-hidden="true"></span>修改</a>
                                </td>
                            </tr>
                        </c:forEach>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-md-12 col-sm-12 col-xs-12">
                <jsp:include page="/WEB-INF/view/common/pager.jsp"></jsp:include>
            </div>
        </div>
    </div>
</div>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog"
     aria-labelledby="myModalLabel">
    <div class="modal-dialog modal-lg" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"
                        aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title" id="myModalLabel"></h4>
            </div>
            <div class="modal-body" id="messageBody"></div>
            <div class="modal-footer"></div>
        </div>
    </div>
</div>

<div class="modal fade" id="selectModal" tabindex="-2" role="dialog" style="z-index:999999;"
     aria-labelledby="selectModalLabel">
    <div class="modal-dialog modal-lg" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"
                        aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title" id="selectModalLabel"></h4>
            </div>
            <div class="modal-body" id="selectBody"></div>
            <div class="modal-footer"></div>
        </div>
    </div>
</div>


<div class="modal fade" id="myAlertModal" tabindex="-1" role="dialog" style="z-index:999999;"
     aria-labelledby="myModalLabel">
    <div class="modal-dialog modal-lg" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"
                        aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title" id="myModalLabel"></h4>
            </div>
            <div class="modal-body" id="alertMessageBody"></div>
            <div class="modal-footer"></div>
        </div>
    </div>
</div>
<jsp:include page="/WEB-INF/view/common/head.jsp"></jsp:include>
<jsp:include page="/WEB-INF/view/common/datatables.jsp"></jsp:include>
<jsp:include page="/WEB-INF/view/common/startbootstrap.jsp"></jsp:include>
<jsp:include page="/WEB-INF/view/common/script_common.jsp"></jsp:include>
<jsp:include page="/WEB-INF/view/common/datepicker_js.jsp"></jsp:include>

<script src="https://cdn.bootcss.com/jquery-validate/1.16.0/jquery.validate.min.js"></script>
<script src="https://cdn.bootcss.com/jquery.form/4.2.1/jquery.form.min.js"></script>
<script type="text/javascript">
    $(function () {
        $(".addBtn").click(
            function (e) {
                e.preventDefault();
                e.stopPropagation();
                $("#myModal").load(
                    "<c:url value='/pyramid/edit.html'/>",
                    function (e) {
                        $('#myModal').modal({
                            backdrop: "static"
                        });
                    });
            });


        $(".noticeBtn").click(
            function (e) {
                e.preventDefault();
                e.stopPropagation();
                $("#myModal").load(
                    "<c:url value='/agent/notice.html'/>",
                    function (e) {
                        $('#myModal').modal({
                            backdrop: "static"
                        });
                    });
            });

        $(".editBtn,.transBtn").click(function (e) {
            e.preventDefault();
            e.stopPropagation();
            $("#myModal").load($(this).attr("href"), function (e) {
                $('#myModal').modal({
                    backdrop: "static"
                });
            });
        });
        $("#dataList a.ajaxLink").click(function (e) {
            e.preventDefault();
            e.stopPropagation();
            var method = "POST";
            var action = $(this).attr("data-role");
            if (action == "delete") {
                if (!window.confirm("数据删除将不能恢复,确认要删除吗?")) {
                    return false;
                }
                method = "DELETE";
            } else if (action == "active") {
                if (!window.confirm("将激活选定的代理,是否继续?")) {
                    return false;
                }
            } else if (action == "reorganize") {
                if (!window.confirm("将对选定的代理执行整顿操作,是否继续?")) {
                    return false;
                }
            }
            var that = $(this);
            $.ajax({
                url: $(that).attr("href"), method: method, complete: function (xhr, ts) {
                    if (xhr.status >= 200 && xhr.status < 300) {
                        var m = $.parseJSON(xhr.responseText);
                        if (m.flag == "0") {
                            $("#alertMessageBody").empty().html("操作成功");
                            $("#myAlertModal").modal({backdrop: "static", show: true});
                            window.setTimeout(function () {
                                $("#search").click();
                            }, 1500);

                        } else {
                            $("#alertMessageBody").empty().html("操作失败").addClass("text-danger");
                            $("#myAlertModal").modal({backdrop: "static", show: true});
                        }

                    } else {
                        $("#alertMessageBody").empty().html("操作失败").addClass("text-danger");
                        $("#myAlertModal").modal({backdrop: "static", show: true});
                    }
                }
            });
        });
        $("tbody tr[data-row]").each(function (index, row) {
            $(row).click(function (event) {
                if (event.target.nodeName != "INPUT") {
                    rowSelect($(this));
                }
                switchCss($(this));
            });
            $(row).bind("contextmenu", function () {
                return false;
            });
        });


        $("#datepicker.input-daterange").datepicker({
            autoclose: true,
            language: "zh-CN",
            todayHighlight: true,
            todayBtn: "linked",
            format: "yyyy-mm-dd",
            endDate: new Date()
        });

    });


</script>
</body>
</html>